#include"syscall.h"
#include"interrupt.h"
#include"stdlib.h"
#include"os_modules.h"
#include"asm_utils.h"

int system_call_table[MAX_SYSTEM_CALL];

SystemService::SystemService()
{
    initialize();
}
void SystemService::initialize()
{
    memset((char*)system_call_table,0,sizeof(int)*MAX_SYSTEM_CALL);
    //代码段选择子默认是DPL=0的平摊模式代码段选择子，DPL=3，否则用户态程序无法使用该中断描述符
    interruptManager.setInterruptDescriptor(0x80,(uint32)asm_system_call_handler,3);
}
bool SystemService::setSystemCall(int index,int function)
{
    system_call_table[index] = function;
    return true;
}